quick navigator
Products
Technologies
Development Tools
*Java* Support
*VTune Environments Supported
*Key Features
*System Requirements
*What People Say About VTune
*How to Order
*Case Studies
*30-Day Free Evaluation Copy of VTune
*Software Updates
*Technical Support
*VTune License Agreement
*Back to Intel Software Performance Products Home
Developer Home Contents Search Feedback Support Intel(r)

Analyzing a Simple Java* Application with VTune and SuperCede - Java Edition

This is a step-by-step process to show the highlights of using VTune with a Java* application. The user is encouraged to explore the VTune screens (ex: context sensitive help, display options, etc.) while going through these instructions.

These instructions reflect working with Java programs using SuperCede’s development environment. Instructions for using other languages and environments will be placed on the following URL as new support is defined:
http://developer.intel.com/design/perftool/vtune/prod_rev.htm

These instructions require that VTune 2.5, SuperCede Java Edition 1.2, and the VTune enabled SuperCede dll’s are installed. The VTune enabled SuperCede dll’s are available at www.supercede.com/vtune.

Create and Compile the XForm Java Application

1. Invoke SuperCede - Java Edition with no active project
2. Click Project->NewProject, type Xform as the Project Name, select an appropriate project directory, click Next. Enter Xform as the component name, select “Create a Console Application”, click Finish. A new window for the Xform project appears.
3. Double click on the “Java Source Files” item, select Source1.java. Type in the following program instead of the Hello World program that is displayed:

public class Xform
{
  public static void main (String args[])
  {
    int i;
    long startTime, endTime;

    double dx[] = new double[3000];
    double dy[] = new double[3000];

    for (i=0; i<3000; i++)
      dy[i] = dx[i] = i;

    startTime = System.currentTimeMillis();
    for (i=0; i<3000; i++)
      for (j=0; j<9000; j++)
        dy[i] += dx[i]/s;
    endTime = System.currentTimeMillis();

    System.out.println("Program completed.\n\n\n");
    System.out.print("Execution time in milliseconds: ");
    System.out.println(endTime-startTime);

    try {Thread.currentThread().sleep(2000);}
        catch (InterruptedException e) {}
  }
}



4. Right-Click on Source1.java, select Rename, type Xform.java. The name “Xform” must exactly match the Xform on the “public class” statement above. Click File->Save.
5. Click Component->Update.
6. After it compiles correctly, click Component->Execute. The program should build and run correctly.
7. Click Component->Extract, select “EXE and Class Files”. Click Extract. By default, Debug is turned on. VTune needs debug information to display source code.

Find Xform’s Hotspot with VTune 2.5

1. Invoke VTune 2.5. If the “VTune Assistant” window appears, close it by unclicking the “Show on Startup” radio button and click the red X. It can be re-invoked with View->Assistant.
2. Click File->NewProject. The NewProject wizard will ask some questions:
    Program to test: The Xform.exe generated in step 7 above. Click Next.
    Working directory: Directory that contains Xform.exe. Click Next.
    Command line parameters, Beginning and ending keystrokes: Leave Blank. Click Next.
    How long for application to run: 20 seconds. Click Next.
    Source Code Dir: Dir where Xform.java is located. Click Next.
    VTune Output Dir: Dir that contains Xform.exe. Click Finish.
3. Click on View->ProjectOptions ->Click Automation tab. Click “Terminate Program When Monitoring Session ends”, Click Close.
4. Click the Run->StartMonitorSession command This runs the Xform program.
5. After several seconds when the application window closes, if VTune is still sampling (“Session starting...” appears in VTune main menu window) click the Run->EndMonitorSession command. Several progress meters appear. When VTune asks to Open the session, click Yes.
6. The modules report appears. Maximize the window. This shows a system wide view of software modules executing in the system.
7. The modules are alphabetical from the top. Double click the Xform.exe line. The HotSpot window appears.
8. Double click on the longest red line, which is the hotspot.
9. The analysis window appears with the hotspot’s source code displayed. Maximize the window. Note the line of source with the biggest “time” number to the left of the line. This is the source code for Xform’s hotspot.

Get Advice on Speeding Up Xform

1. Double click on the hotspot source line: dy[i] += dx[i]/0.45; VTune’s Java coach shows some advice on how to make the program faster. In this case it relates to moving the loads of dy & dx (and, in fact, the entire statement dy[i] += dx[i]/0.45) out of the inner loop.
    Click the question mark next to the advice for more detail.
    Close Java coach window.
    At this point you may want to make the suggested changes to the source code of Xform, recompile and see how much it is improved.
2. Click the View->MixAssemblerAndSource command.
In this view VTune displays detailed information from the CPU’s point of view as to how the Java program executes. Native assembly language code for the Java program is displayed. This native code is annotated with detailed information about how the processor executes these instructions. Included are Pentium® processor pairing information (color coded on the left), Pentium processor clock cycle counts, performance penalties, and CPU usage percentages from the profiling done earlier. Other data may be requested (Pentium II processor micro-ops, decoder groups, etc) using the Options->ColumnDisplayOptions command.
3. VTune also gives instruction level advice. Double click the line that has the penalty “FP_Dep_st(0)” on the right to learn more about ways performance can be improved.


* Legal Information © 1998 Intel Corporation